import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import CoreLayout from 'containers/layout'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { protoActions } from 'reduxs'
import { getDataSource, getFlagValue, showTeam, getTeamFlag, getPageFlag, toDuration } from 'services/utils'
import DescriptionList from 'ant-design-pro/lib/DescriptionList'
import Ellipsis from 'ant-design-pro/lib/Ellipsis'
import QueryTable from '../components/query-table'
import _ from 'lodash'

const accessFlag = getPageFlag('/proto-data/seven-others', 'access')
const { Description } = DescriptionList
const durationFormat = {
  day: '${day}天${hour}时${minute}分${second}秒',
  hour: '${hour}时${minute}分${second}秒',
  minute: '${minute}分${second}秒',
  second: '${second}秒',
  millisecond: '${millisecond}毫秒',
}

@connect(
  state => ({
    parser              : state.Proto.parser
  }),
  dispatch => ({
    actions: bindActionCreators({ 
      ...protoActions
    }, dispatch)
  })
)
export default class SevenOthers extends PureComponent {

  render () {
    const { location, parser, paths } = this.props
    let options = {
      layoutOptions: {
        location,
        pageCode: accessFlag.value,
        breadcrumb: [
          { name: '主页', link: '/' },
          { name: '数据统计类' },
          { name: '房间数据查询' }
        ],
      },
      searchOptions: {
        begin_end: {
          name: '时间段',
          format: 'YYYY-MM-DD',
          required: { required: true, message: `请选择时间段!` }
        },
      },
      proto: 'seven-others',
      tableColumns: [
        {
          key: '1',
          title: '时间',
          dataIndex: 'data_0',
          render: (data_0) => data_0.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'),
          width: 120
        },
        {
          key: '3',
          title: '七日签到',
          dataIndex: 'data_2',
          render: (data_2) => <Ellipsis length={38} tooltip>{data_2}</Ellipsis>,
          width: 300
        },
        {
          key: '4',
          title: '游戏内抽奖',
          dataIndex: 'data_3',
          render: (data_3) => <Ellipsis length={38} tooltip>{data_3}</Ellipsis>,
          width: 300
        },
        {
          key: '5',
          title: '转盘信息',
          dataIndex: 'data_4',
          render: (data_4) => <Ellipsis length={38} tooltip>{data_4}</Ellipsis>,
          width: 300
        },
        {
          key: '6',
          title: '炮台解锁信息',
          dataIndex: 'data_5',
        },
      ],
      tableScroll: {  },
      tablePagination: true,
      //remark: []

    }
    return (
      <QueryTable  {...options} />
    )
  }
}